<?php
/**
 * Created by PhpStorm.
 * User: function
 * Date: 2018-04-13
 * Time: 0:26
 */

namespace app\api\controller\v1;
use app\common\controller\Api;
use app\common\logic\CompanyLogic;
class Company extends Api
{
    protected $authenticate = ['only'=>'fdsa'];
    
    public function index()
    {
        $params = paramForm();
        
        //如果有id参数，则表示获取单个
        if(isset($params['user_id'])){
            $this->read($params);
            die;
        }
        
        $logicClass = $this->logicClass;
        $logic = new $logicClass();
        
        $lists = $logic->getList($params);
        if($lists){
            success($lists);
        }else{
            error('没有符合的数据');
        }
        
    }
    
    public function read($params)
    {
        

        $logic = new CompanyLogic();
        
        $one = $logic->getOne($params['user_id'],$params['mallsize']);
        if($one){
            success($one);
        }else{
            error('数据不存在或者无权限查看');
        }
        
    }
    
   
    
}